package com.qtummatrix.controller;

import com.opensymphony.xwork2.ActionSupport;
import org.springframework.stereotype.Controller;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

@Controller("download")
public class DownloadController extends ActionSupport {
	
	//下载文件目录
	private String downLoadPath;
	
	//下载文件名称
	private String fileName;
	
	//文件输入流
	private InputStream inputStream;

	public String getDownLoadPath() {
		return downLoadPath;
	}

	public void setDownLoadPath(String downLoadPath) {
		this.downLoadPath = downLoadPath;
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public InputStream getInputStream() {
		return inputStream;
	}

	public void setInputStream(InputStream inputStream) {
		this.inputStream = inputStream;
	}
	
	public String downLoad() {
		//获取下载文件在服务器的路径
		fileName = "addBlacklist.xls                                                                      ";
        String path = "C:/start/"+fileName;
			try {
				inputStream = new FileInputStream(path);
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		
		return SUCCESS;
	}
	
	  
}
